/**
 * 
 */
package com.es.disped.common.sms;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.es.disped.common.constant.AliSms;
/**
 * @author Anson<br>
 *
 * Copyright by EasyShare 2019<br>
 *
 * All right reserved<br>
 *
 * Created on 下午1:11:04<br>
 *
 * 名称：SmsClient.java<br>
 *
 * 描述：提供阿里云短信客户端<br>
 */
public class SmsClient extends AliSms{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1630607837618861484L;
	private IAcsClient client=null;
	private CommonRequest request=null;
	private CommonResponse response=null;
	private int status;
	private AliMsg aliMsg=null;
	
	public SmsClient() {
		this.request=new CommonRequest();
		this.client = new DefaultAcsClient(DefaultProfile.getProfile(
				ALI_MESSAGE_REGIION_ID, ALI_ACCESS_KEY_ID, ALI_ACCESS_SECRET));
	}

	/**
	 * @return the client
	 */
	public IAcsClient getClient() {
		return client;
	}

	/**
	 * @param client the client to set
	 */
	public void setClient(IAcsClient client) {
		this.client = client;
	}

	/**
	 * @return the request
	 */
	public CommonRequest getRequest() {
		return request;
	}

	/**
	 * @param request the request to set
	 */
	public void setRequest(CommonRequest request) {
		this.request = request;
	}

	/**
	 * @return the response
	 */
	public CommonResponse getResponse() {
		return response;
	}

	/**
	 * @param response the response to set
	 */
	public void setResponse(CommonResponse response) {
		this.response = response;
	}

	/**
	 * @return the status
	 */
	public int getStatus() {
		if(!this.isNull(getResponse()))
		{
			setStatus(this.getResponse().getHttpStatus());
		}
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(int status) {
		this.status = status;
	}

	/**
	 * @return the aliMsg
	 */
	public AliMsg getAliMsg() {
		if(!this.isNull(getResponse()))
		{
			aliMsg=this.fromJson(this.getResponse().getData(), AliMsg.class);
		}
		return aliMsg;
	}
	
	/**
	 * @param aliMsg the aliMsg to set
	 */
	public void setAliMsg(AliMsg aliMsg) {
		this.aliMsg = aliMsg;
	}
}
